import time
from celery import Celery

backend = 'redis://127.0.0.1:6379/1'
broker = 'redis://127.0.0.1:6379/2'

app = Celery('test', broker=broker, backend=backend)


@app.task
def send_email(name):
    print(f'向{name}发送邮件。。。')
    time.sleep(5)
    print(f'向{name}发送邮件成功。。。')
    return name


@app.task
def send_msg(name):
    print(f'向{name}发送短信。。。')
    time.sleep(5)
    print(f'向{name}发送短信成功。。。')
    return name
